#include "imageprocess.h"

ImageProcess::ImageProcess(QObject *parent): QThread(parent)
{

}

void ImageProcess::setLittlePicture(cv::Mat pic){

    this->littlePicture = pic;
}


void ImageProcess::run()
{
    cv::Rect face_roi=cv::Rect(0,0,0,0);
    std::string name_result="";
    int flag=0;
    cv::Mat resFace = littlePicture.clone();
    processor.identify(littlePicture,face_roi,name_result,flag);
    cv::Mat faceFrame = resFace(face_roi).clone();
    emit display(faceFrame);
    emit display(QString::fromStdString(name_result) ,1);
    std::string result ="";
    if(flag==3)
    {
        result="keep face in center of camera";
    }
    else if(flag==4)
    {
        result="not frontal face";
    }
    else if(flag==5)
    {
        result=" image too blur";
    }
    emit display(QString::fromStdString(result) ,2);

}
